<?php
defined('APP_PATH') or die ('Unauthorized access');
/**
 * 通用方法库
 */
class Ext_Func
{	
	public function __construct()
	{
		
	}
	
	public function hextorgb($color = '')
	{
		if(empty($color))	return array('r' => 255, 'g' => 255, 'b' => 255);
		
		$color = str_replace("#",'',$color);
		
		$r = strlen($color) < 3 ? substr($color,0,1).substr($color,0,1) : substr($color,0,2);
		$g = strlen($color) < 3 ? substr($color,1,1).substr($color,1,1) : substr($color,2,2);
		$b = strlen($color) < 3 ? substr($color,2,1).substr($color,2,1) : substr($color,4,2);
		
		return array(
			'r' => hexdec($r),
			'g' => hexdec($g),
			'b' => hexdec($b)
		);
	}
}